const { merge } = require("webpack-merge");
const baseConfig = require("./webpack.config");
const path = require("path");

process.env.NODE_ENV = "development";

// const target = "http://127.0.0.1:3000/";
const target = "http://192.168.31.189:5201/";

module.exports = merge(baseConfig, {
  mode: "development",
  devServer: {
    hot: true,
    port: 3333,
    historyApiFallback: true,
    before(app) {
      app.get("/css/antd.4.24.5.min.css", (req, res) => {
        res.sendFile(
          path.resolve(__dirname, "public/css", "antd.4.24.5.min.css")
        );
      });
    },
    proxy: {
      "/api": {
        target,
        changeOrigin: true,
      },
      "/images": {
        target,
        changeOrigin: true,
      },
      "/mp4": {
        target,
        changeOrigin: true,
      },
    },
  },
});
